home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-PR / Interfaces&Libraries / Interfaces / CIncludes / intrinsics.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-16  |  4.4 KB  |  95 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Intrinsics.h
  4.     
  5.     Copyright Apple Computer,Inc.  1996, 1998
  6.     All rights reserved
  7.  
  8.     Instruction intrinsics are pseudo-functions which may be expanded  
  9.     inline by the compiler to provide direct access to selected PowerPC 
  10.     machine instructions.  If compiler support is not provided for inline
  11.     expansion then references to these functions will generate external 
  12.     function references.  MrC[pp] versions 2.0 and later recognize the
  13.     intrinsics and perform inlining but earlier versions of MrC do not.
  14.     
  15.     With exceptions noted below, the function's name and prototype follow 
  16.     from the machine instruction's name and operands.  The function return 
  17.     value corresponds to the instruction's destination operand, e.g. FABS; 
  18.     the function returns void if there is no destination operand, e.g. STHBRX.  
  19.     The function's arguments agree in number and correspond with the
  20.     instruction's source operands.  The correspondence is also shown by 
  21.     the function argument names in relation to the instruction template 
  22.     in the comment next to each function.
  23.  
  24.     The PowerPC architecture manuals describe these instructions in detail.
  25.     
  26.     Naming exception: __setflm does not correspond to a machine instruction.
  27.     It uses two instructions, MFFS and MTFSF, to store the low 32 bits of 
  28.     its double argument into FPSCR and return the previous value of FPSCR 
  29.     in the low 32 bits of its return value.
  30.     
  31. ************************************************************/
  32.  
  33. #ifndef __INTRINSICS__
  34. #define __INTRINSICS__
  35.  
  36. #include <ConditionalMacros.h>
  37.  
  38. #if GENERATINGPOWERPC
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. int __abs(int rB);                                        /* SRAWI rA,rB,31; XOR rT,rB,rA; SUB rD,rT,rA */
  45. int __cntlzw(unsigned int rS);                            /* CNTLZW    rA,rS */
  46. void __dcbf(void * rA, int rB);                            /* DCBF        rA,rB */
  47. void __dcbt(void *rA, int rB);                            /* DCBT        rA,rB */
  48. void __dcbst(void *rA, int rB);                            /* DCBST    rA,rB */
  49. void __dcbtst(void *rA, int rB);                        /* DCBTST    rA,rB */
  50. void __dcbz(void *rA, int rB);                            /* DCBZ        rA,rB */
  51. void __eieio(void);                                        /* EIEIO */
  52. double __fabs(double frB);                                /* FABS        frD,frB */
  53. float __fabsf(float frB);                                /* FABS        frD,frB */
  54. double __fmadd(double frA,double frC,double frB);        /* FMADD    frD,frA,frC,frB */
  55. float __fmadds(float frA,float frC,float frB);            /* FMADDS    frD,frA,frC,frB */
  56. double __fmsub(double frA,double frC,double frB);        /* FMSUB    frD,frA,frC,frB */    
  57. float __fmsubs(float frA,float frC,float frB);            /* FMSUBS    frD,frA,frC,frB */
  58. double __fnabs(double frB);                                /* FNABS    frD,frB */
  59. float __fnabsf(float frB);                                /* FNABS    frD,frB */
  60. double __fnmadd(double frA,double frC,double frB);        /* FNMADD    frD,frA,frC,frB */
  61. double __fnmsub(double frA,double frC,double frB);        /* FNMSUB    frD,frA,frC,frB */
  62. float __fnmadds(float frA,float frC,float frB);            /* FNMADDS    frD,frA,frC,frB */
  63. float __fnmsubs(float frA,float frC,float frB);            /* FNMSUBS    frD,frA,frC,frB */
  64. double __frsqrte(double frB);                            /* FRSQRTE    frD,frB */ 
  65. float __fres(float frB);                                /* FRES        frD,frB */
  66. double __fsel(double frA,double frC,double frB);        /* FSEL        frD,frA,frC,frB */
  67. double __fsqrt(double frB);                                /* FSQRT    frD,frB */
  68. float __fsqrts(float frB);                                /* FSQRTS    frD,frB */
  69. void __icbi(void *rA, int rB);                            /* ICBI        rA,rB */
  70. void __isync(void);                                        /* ISYNC */
  71. long __labs(long rB);                                    /* SRAWI rA,rB,31; XOR rT,rB,rA; SUB rD,rT,rA */
  72. unsigned int __lhbrx(void *rA, int rB);                    /* LHBRX    rD,rA,rB */
  73. unsigned int __lwbrx(void *rA, int rB);                    /* LWBRX    rD,rA,rB */
  74. double __mffs(void);                                    /* MFFS        frD */
  75. unsigned int __mfxer(void);                                /* MFSPR    rD,1 */
  76. void __mtfsb0(unsigned int BT);                            /* MTFSB0    BT */
  77. void __mtfsb1(unsigned int BT);                            /* MTFSB1    BT */
  78. int __mulhw(int rA, int rB);                            /* MULHW    rD,rA,rB */
  79. unsigned int __mulhwu(unsigned int rA, unsigned int rB);/* MULHWU    rD,rA,rB */
  80. int __rlwimi(int rA,int rS,int SH,int MB,int ME);        /* RLWIMI    rA,rS,SH,MB,ME */
  81. int __rlwinm(int rS,int SH,int MB,int ME);                /* RLWINM    rA,SH,MB,ME */
  82. int __rlwnm(int rS,int rB,int MB,int ME);                /* RLWNM    rA,rS,rB,MB,ME */
  83. double __setflm(double frB);                            /* MFFS    frD; MTFSF 255,frB */
  84. void __sthbrx(unsigned short rS, void *rA, int rB);        /* STHBRX    rS,rA,rB */
  85. void __stwbrx(unsigned int rS, void *rA, int rB);        /* STWBRX    rS,rA,rB */
  86. void __sync(void);                                        /* SYNC */
  87.  
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91.  
  92. #endif /* GENERATINGPOWERPC */
  93.  
  94. #endif /* __INTRINSICS__ */
  95.